//
//  FSCExamCell.swift
//  FamiliesSchoolConnection
//
//  Created by 花花蔡 on 2016/12/29.
//  Copyright © 2016年 com.HuaHuaCai. All rights reserved.
//

import UIKit

class FSCExamCell: UITableViewCell {

    @IBOutlet weak var bgView: UIView!
    @IBOutlet weak var titleL: UILabel!
    
    @IBOutlet weak var objectBtn: UIButton!
    
    @IBOutlet weak var teacherTalkL: UILabel!
    
    @IBOutlet weak var teacherNameL: UILabel!
    
    @IBOutlet weak var timeL: UILabel!
    
    @IBOutlet weak var scoreBtn: UIButton!
    
    var model:FSCExaminationModel? {
        
        didSet {
            guard let model = model else {
                return
            }
            titleL.text = model.es_title
            objectBtn.setTitle(model.es_course, for: .normal)
            teacherTalkL.text = model.es_comment
            teacherNameL.text = model.es_teacherName
            timeL.text = model.es_createDate
            scoreBtn.setTitle("\(model.es_score)", for: .normal)
            if model.es_score < 60 {
                scoreBtn.setBackgroundImage(UIImage(named:"未提交"), for: .normal)
            }else {
                scoreBtn.setBackgroundImage(UIImage(named:"提交"), for: .normal)
            }
        }
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        setupUI()
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    func setupUI() -> Void {
        objectBtn.layer.cornerRadius = 5
        objectBtn.layer.borderWidth = 1
        objectBtn.layer.borderColor = UIColor.colorWithHex(hexColor:blueColor).cgColor
        objectBtn.setTitleColor(UIColor.colorWithHex(hexColor: blueColor), for: .normal)
        bgView.isHidden = true

    }
    
}
